{include file="common/head"}
<head>
<title>菜单项新增</title>
    <style type="text/css">
      .group_item{padding:0px 4px;margin:5px;border:1px solid #666;border-radius: 4px;width:max-content;display:inline-block;}
    </style>
</head>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;" >
    <h2>菜单项新增</h2>
    <form method="post" action="/index.php/menu/menu_add">

      <div class="mb-3 mt-3">
        <lable for="fid" class="form-label">父级菜单(Categray):</label>
        <select id="fid" name="fid" class="form-control">
            {foreach $top_menu as $k=>$v}
                <option value="{$k}" >{$v['name']}</option>
            {/foreach}
        </select>
      </div>
      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">菜单项名称(Name):</label>
        <input type="text" class="form-control" id="name" name="name" value="" placeholder="Name" />
      </div>
      <div class="mb-3 mt-3">
        <lable for="url_key" class="form-label">关键字(Keyword):</label>
        <input type="text" class="form-control" id="url_key" name="url_key" value="" placeholder="Keyword" />
      </div>      
      <div class="mb-3">
        <label for="title" class="form-label">说明(Title):</label>
        <input type="text" class="form-control" id="title" name="title" value="" placeholder="Title" />
      </div>

      <div class="mb-3">
        <label for="status" class="form-label">是否启用(Using):</label>
          <input type="radio" class="form-check-input" id="radio1" name="status" value="1" checked /> 
          <label class="form-check-label" for="radio1">启用(Using)</label>
          <input type="radio" class="form-check-input" id="radio2" name="status" value="2" />
          <label class="form-check-label" for="radio2">停用(Stoped)</label>
       </div>


      <div class="mb-3">
        <label for="status" class="form-label">权限组:</label>
          {$g_html|raw}
       </div>

      <button  type="button" class="btn btn-primary" onclick="doSave()">保存(Save)</button>       
    </form>
    </div>

<script type="text/javascript">
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的名称(Invalid name)!");
        return 0;
      }    
      //询问框
      layer.confirm('是否确定保存?', {
        btn: ['YES','CANCEL'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });
    }

</script>


</body>
</html>
